public abstract class Option {
      char shortName;
      String fullName;
      boolean isNecessary;
      Object value;
      
      public Option(char s, String f, boolean n) {
         shortName=s;
         fullName=f;
         isNecessary=n;
      }
      
      public void setValue(Object v) { value=v; }
      public Object getValue() { return value; }
      public abstract void parse(String s);
      
      public boolean match(String arg) {
         if(arg==null || arg.length()<2) {
            throw new IllegalArgumentException();
         }
         if(arg.startsWith("--")) {
            if(fullName.equals(arg.substring(2))) {
               return true;
            }
         } else if(arg.startsWith("-")) { //: "-" is included in "--", has to be at the second place
            if(shortName==arg.charAt(1)) {
               return true;
            }
         }
         return false;
      }
   }
   class BooleanOption extends Option {
      public BooleanOption(char s, String f, boolean n) {
         super(s, f, n);
      }
      @Override
      public void parse(String s) {
         setValue(Boolean.valueOf(s));
      }
      
   }
   class StringOption extends Option {
      public StringOption(char s, String f, boolean n) {
         super(s, f, n);
      }
      @Override
      public void parse(String s) {
         setValue(String.valueOf(s));
      }
   }
   class IntegerOption extends Option {
      public IntegerOption(char s, String f, boolean n) {
         super(s, f, n);
      }
      @Override
      public void parse(String s) {
         setValue(Integer.valueOf(s));
      }
   }